package com.neo.impatient.C05_Class.C05_04_objPrivate

class ObjPrivate {

  /** 其他对象可以访问*/
  private var value = 0

  /** 只有当前对象可以访问*/
  private[this] var value1 = 1

  def increment() {
    value += 1
  }


  def increment1() {
    value1 += 1
  }

  /** */
  def isLess(other: ObjPrivate) = value1 < other.value

  /** 不可以访问value1*/
  //def isLess(other: ObjPrivate) = value1 < other.value1

}

object ObjPrivate {


  def main(args: Array[String]): Unit = {
    val objPrivate = new ObjPrivate()
    println(objPrivate.value)
    objPrivate.increment()
    println(objPrivate.value)

    val oj = new ObjPrivate()
    for(i <- 0 to 10)
      oj.increment1()


    println(oj.isLess(objPrivate))

    for (i <- 0 to 10)
      oj.increment1()
    println(oj.isLess(objPrivate))
  }
}
